package chapter02

object Test29_Tuple {
  def main(args: Array[String]): Unit = {
    //定义元组
    val tuple = ("张三", 20, "大数据2班")
    //访问元组中的元素
    println(tuple._1)
    println(tuple._2)
    println(tuple._3)
    //通过索引访问
    println(tuple.productElement(0))
    //通过索引遍历元素
    for(i<-tuple.productIterator) println(i)
    val map = Map("a"->1, "b"->2, "c"->3)
    val map1 = Map(("a",1), ("b",2), ("c",3))
    map.foreach(e=>println(e))
    map1.foreach(e=>println(e))
    List(Map("name"->"张三","语文"->70,"数学"->80,"英语"->"90"))
  }
}
